package com.kaibes.admin.shelter;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.kaibes.module.shelter.ShelterUtils;
import com.kaibes.web.admin.AdminMenu;
import com.kaibes.web.admin.AdminMenuRes;
import com.kaibes.web.thymeleaf.ThymeleafConfig;

@Configuration
public class ShelterInit implements InitializingBean {

    @Autowired
    private ShelterUtils shelterUtils;
    @Autowired
    private ThymeleafConfig thymeleafConfig;
    
    @Bean
    public AdminMenu shelterMenu() {
        AdminMenu menu = new AdminMenu();
        menu.setKey("shelters");
        menu.setName("屏蔽设置");
        menu.setIcon("fas fa-users-cog");
        menu.setHref("/admin/shelter");
        menu.setSort(3);
        menu.setParentKey(AdminMenuRes.MENU_SETTING);
        return menu;
    }

	@Override
	public void afterPropertiesSet() throws Exception {
		thymeleafConfig.putStaticVariable("shelterUtils", shelterUtils);
	}
    
}
